package com.cordys.opensource.crom;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

import com.cordys.cpc.bsf.busobject.BusObject;


/**
 * This annotation must be used by DomainObjects that need to be revisioned inside the database (such as Solution).
 * @see DomainObject
 * @see BusObjectMetadata
 * @see RevisionObjectEventListener
 */
@Retention(RetentionPolicy.RUNTIME)
public @interface RevisionedObject
{
	/**
	 * Default column name for the Created By field to be filled whenever a new record is inserted
	 */
	public static final String CREATED_BY = "CreatedBy";
	/**
	 * Default column name for the Created On field to be filled by the Temporal Pattern implementation
	 */
	public static final String CREATED_ON = "CreatedOn";
	/**
	 * Default column name for the Created On field to be filled by the Temporal Pattern implementation
	 */
	public static final String EXPIRED_ON = "ExpiredOn";
	/**
	 * Returns the name of the table with the revisioned values for the DomainObject.
	 * Returns the WS-AppServer database class that has to be used to persist the DomainObject.
	 * E.g., for the crom.example.domain.SolutionRevision domain object, this returns crom.example.db.SolutionRevision (there is no example in crom right now).
	 * If a value is not specified, then a db class will be searched based on the class name of the DomainObject inside the db package.
	 */
	Class<? extends BusObject> table_revision() default BusObject.class;
	/**
	 * Returns the name of the field in the revision table that can be used to
	 * fill the creation date of the moment the system inserts a new record.
	 */
	String createdOnField() default CREATED_ON;
	/**
	 * Returns the name of the field in the revision table that can be used to
	 * fill the expiration date at the moment the system deletes the object or inserts an update
	 * on the object.
	 */
	String expiredOnField() default EXPIRED_ON;
}
